package com.tangyuan.common.config;


import com.alipay.api.AlipayClient;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;


/**
 * 支付宝实体类
 *
 * @author pzm
 * @date 2022/11/8 11:27
 */
@Component
@Data
public class AlipayConfig {
    /**
     * 设置网关地址(正式环境)
     */
    public static final String APP_GATEWAY = "https://openapi.alipay.com/gateway.do";
    /**
     * 设置应用Id
     */
    public static final String ALIPAY_APPID = "2021004138676319";
    /**
     * 私钥
     */
    public static final String APP_PRIVATE_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCdoTLMFtJSCCBEplcX6GgWp0w6z9UBfqJmzm0y0amwz152TZMEveW53/wv5wnKHgN7JSmDqp6S3AP/MCCUMKtlUSy7Qh+/KIeQdh680fg3/9Hl4NxII1TppfQj0jp6gLJnWZhPwsRb2k6tEcdz/pFYIu1Nszt0Uy4BIpXtkhhrxLjby2hYevckpJDM125goVj3EkbrysnhEY2SfcpH1I3xQFCaUo63PY4FLzj9fK7Azw/MjWJ9XrbYHB1pwlH17Irwi/e2DtLALoY+XAi3uo6fNQnKmclWQ6K9rzvhY0tkMqCYZWQYz4IGBG1dQh5qHseuMFVWtxRS5z8xL2mIT6GrAgMBAAECggEBAJJQzBcXY/jTJCi1AojlqKDGgALjYgP2KQcmu8P9S/ccNcG4dixjnLbxi2Rnn/Wl8HNBZoyaNoF5ipg4czU7DA2K0OutEEzfcR6OFjAM8swAQTSRicfITAxph/osLS4DAhbe2nvG/X+JX5hUtYAdH4rhOMb0BM8QWtag5OxVvSdiRQLfwuObmZYQkbk70TIvIZm34qfGdoUpuApzMsKqtoVR+i8BPRQRoHDnALj9Q5L2+z0YNRZIw5aqtxauAsW+BJQREZsScplKf8BFoM5Svj54BQXrJ4WR8bALGAIOzNtdmXuYVeTmw6TFviD71uo1CWMWz5bk4VmIC0x0kqnKWSECgYEA6ryCXruOvCJeEmVBZLhilRKLb0e8rbaDMgL/Mx/bi+C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TbM7dFMuASKV7ZIYa8S428toWHr3JKSQzNduYKFY9xJG68rJ4RGNkn3KR9SN8UBQmlKOtz2OBS84/XyuwM8PzI1ifV622BwdacJR9eyK8Iv3tg7SwC6GPlwIt7qOnzUJypnJVkOiva874WNLZDKgmGVkGM+CBgRtXUIeah7HrjBVVrcUUuc/MS9piE+hqwIDAQAB";



    /**
     * 设置字符集
     */
    public static final String CHARSET = "utf-8";
    /**
     * 设置签名类型
     */
    public static final String SIGNTYPE = "RSA2";

    /**
     * 异步通知地址
     */
    public static final String NOTIFYURL = "https://www.tangyuanshipin.com/api/user/alipay/authRedirect";

    /**
     * 设置商户号,多个可用英文逗号隔开
     */
    public static final String SELLER_ID = "2088841017810505";
    /**
     * 接口权限值，目前只支持auth_user和auth_base两个值-->>
     * auth_base：以auth_base为scope发起的网页授权，是用来获取进入页面的用户的userId的，并且是静默授权并自动跳转到回调页的。用户感知的就是直接进入了回调页（通常是业务页面）。
     * auth_user：以auth_user为scope发起的网页授权，是用来获取用户的基本信息的（比如头像、昵称等）。但这种授权需要用户手动同意，用户同意后，就可在授权后获取到该用户的基本信息。若想获取用户信息，scope的值中需要有该值存在，如scope=auth_user,auth_base。
     */
    public static final String SCOPE = "auth_user";


    public static String appCertPublicKey;
    public static String alipayCertPublicKey;
    public static String alipayRootCert;
    @Value("${ali.pay.app_cert_public_key:}")
    public void setApiClientCertPem(String appCertPublicKey) {
        AlipayConfig.appCertPublicKey = appCertPublicKey;
    }

    @Value("${ali.pay.alipay_cert_public_key:}")
    public void setPlatformCertPem(String alipayCertPublicKey) {
        AlipayConfig.alipayCertPublicKey = alipayCertPublicKey;
    }

    @Value("${ali.pay.alipay_root_cert:}")
    public void setApiClientKeyPem(String alipayRootCert) {
        AlipayConfig.alipayRootCert = alipayRootCert;
    }

}
